package com.example.springbootminiodemo.controller;

import com.example.springbootminiodemo.entity.AddDocumentVo;
import com.example.springbootminiodemo.entity.DocumentInfo;
import com.example.springbootminiodemo.service.DocumentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/document")
public class DocumentController {
  
  @Autowired
  private DocumentService documentService;
  
  
  /**
   * 添加文档服务
   *
   * @return
   * @throws Exception
   * @auther: lihh
   */
  @PostMapping("/addDocument")
  public DocumentInfo addDocument(@RequestParam("file") MultipartFile file, AddDocumentVo documentVo) throws Exception {
    documentVo.setFile(file);
    return documentService.addDocument(documentVo);
  }
}
